package com.design.yjx.proxy.rmi.service;

import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;

/**
 * @author yuanjianxin
 * @date 2017/8/25 11:33
 *
 * 服务器代码
 */
public class Main {
    public static void main(String[] args) {
        try {
            MyRemote service = new MyRemoteImpl();
            //注册端口
            LocateRegistry.createRegistry(11233);
            //绑定到注册表中，myRemote是key
            Naming.rebind("//127.0.0.1:11233/myRemote", service);
            System.out.println("远程对象绑定成功");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
